<html xmlns="https://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Language" content="zh-CN" />
<link href="../style/css/manual-zip.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
<link href="../style/css/manual-zip-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
<link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" />
<title>mod_cache － Apache 2.2 中文手册 [金步国]</title>
<script> var _hmt = _hmt || []; (function() { var hm = document.createElement("script"); hm.src = "https://hm.baidu.com/hm.js?d286c55b63a3c54a1e43d10d4c203e75"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); })(); </script>
</head>
<body><div id="page-header">
<p class="menu"><a href="index.html">模块索引</a> | <a href="directives.html">指令索引</a> | <a href="../faq/index.html">常见问题</a> | <a href="../glossary.html">词汇表</a> | <a href="../sitemap.html">站点导航</a></p><p class="apache">Apache HTTP Server 版本2.2</p><img alt="" src="../images/feather.gif" /></div>
<div class="up"><a href="index.html"><img title="&lt;-" alt="&lt;-" src="../images/left.gif" /></a></div>
<div id="path"><a href="https://www.apache.org/">Apache</a> &gt; <a href="https://httpd.apache.org/">HTTP Server</a> &gt; <a href="https://httpd.apache.org/docs/">文档</a> &gt; <a href="../index.html">版本2.2</a> &gt; <a href="index.html">模块</a></div>

<div id="translation-info">　　 <a href="../translator_announcement.html#thanks">致谢</a> | 本篇译者：&lt;<a href="../translator_announcement.html#join">虚位以待</a>&gt; | 本篇译稿完成时间：?年?月?日</div>
<div id="page-content"><div id="preamble"><h1>Apache模块 mod_cache</h1>

<table border="1" cellpadding="0" cellspacing="0" bordercolor="#AAAAAA" class="module">
<tr><th><a href="module-dict.html#Description">说明</a></th><td>基于URI键的内容动态缓冲(内存或磁盘)</td></tr>
<tr><th><a href="module-dict.html#Status">状态</a></th><td>扩展(E)</td></tr>
<tr><th><a href="module-dict.html#ModuleIdentifier">模块名</a></th><td>cache_module</td></tr>
<tr><th><a href="module-dict.html#SourceFile">源文件</a></th><td>mod_cache.c</td></tr>
</table>
<h3>概述</h3>

    <div class="warning">这个模块使会绕过<code class="directive"><a href="mod_authz_host.html#allow">Allow</a></code>和<code class="directive"><a href="mod_authz_host.html#deny">Deny</a></code>设置的访问控制。所以，你不应该缓冲任何根据这两个指令设置了访问控制的内容。</div>

    <p><code class="module"><a href="mod_cache.html">mod_cache</a></code>实现了一个<a href="http://www.ietf.org/rfc/rfc2616.txt">RFC 2616</a>兼容的HTTP本地缓存或HTTP代理缓存。<code class="module"><a href="mod_cache.html">mod_cache</a></code>需要一个或多个存储管理模块提供的服务才能正常工作。目前官方发布的存储管理模块有两个：</p>
    <dl>
    <dt><code class="module"><a href="mod_disk_cache.html">mod_disk_cache</a></code></dt>
    <dd>一个基于磁盘的存储管理模块。</dd>

    <dt><code class="module"><a href="mod_mem_cache.html">mod_mem_cache</a></code></dt>
    <dd>一个基于内存的存储管理模块。<code class="module"><a href="mod_mem_cache.html">mod_mem_cache</a></code>可以被配置为两种不同的操作模式：①缓存打开的文件描述符；②在堆(heap)上缓存对象。<code class="module"><a href="mod_mem_cache.html">mod_mem_cache</a></code>既可以用于缓存本地生成的内容，也可以用于为<dfn>反向代理</dfn>模式下的<code class="module"><a href="mod_proxy.html">mod_proxy</a></code>(参见<code class="directive"><a href="mod_proxy.html#proxypass">ProxyPass</a></code>)缓存后端服务器输出的内容。</dd>
    </dl>

    <p>内容将被以基于URI的索引存入和检出，但是并不保存相应的访问控制信息。</p>
    <p>更多的细节、讨论、实例，可以参考<a href="../caching.html">缓冲指南</a>。</p>
</div>
<div class="top"><a href="mod_cache.html#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="section">
<h2><a name="related" id="related">相关模块和指令</a></h2>
    <table border="1" cellpadding="0" cellspacing="0" bordercolor="#AAAAAA" class="related">
<tr><th>相关模块</th><th>相关指令</th></tr>
<tr><td><ul><li><code class="module"><a href="mod_disk_cache.html">mod_disk_cache</a></code></li><li><code class="module"><a href="mod_mem_cache.html">mod_mem_cache</a></code></li></ul></td><td><ul><li><code class="directive"><a href="mod_disk_cache.html#cacheroot">CacheRoot</a></code></li><li><code class="directive"><a href="mod_disk_cache.html#cachesize">CacheSize</a></code></li><li><code class="directive"><a href="mod_disk_cache.html#cachedirlevels">CacheDirLevels</a></code></li><li><code class="directive"><a href="mod_disk_cache.html#cachedirlength">CacheDirLength</a></code></li><li><code class="directive"><a href="mod_disk_cache.html#cacheminfilesize">CacheMinFileSize</a></code></li><li><code class="directive"><a href="mod_disk_cache.html#cachemaxfilesize">CacheMaxFileSize</a></code></li><li><code class="directive"><a href="mod_mem_cache.html#mcachesize">MCacheSize</a></code></li><li><code class="directive"><a href="mod_mem_cache.html#mcachemaxobjectcount">MCacheMaxObjectCount</a></code></li><li><code class="directive"><a href="mod_mem_cache.html#mcacheminobjectsize">MCacheMinObjectSize</a></code></li><li><code class="directive"><a href="mod_mem_cache.html#mcachemaxobjectsize">MCacheMaxObjectSize</a></code></li><li><code class="directive"><a href="mod_mem_cache.html#mcacheremovalalgorithm">MCacheRemovalAlgorithm</a></code></li><li><code class="directive"><a href="mod_mem_cache.html#mcachemaxstreamingbuffer">MCacheMaxStreamingBuffer</a></code></li></ul></td></tr>
</table>
</div><div class="top"><a href="mod_cache.html#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="section">
<h2><a name="sampleconf" id="sampleconf">示范配置</a></h2>
    <div class="example"><h3>httpd.conf 示例</h3><p><code>
      #<br />
      # 缓存示范配置<br />
      #<br />
      LoadModule cache_module modules/mod_cache.so<br />
      <br />
      &lt;IfModule mod_cache.c&gt;<br />
      <span class="indent">
        #LoadModule disk_cache_module modules/mod_disk_cache.so<br />
        # 如果你想使用mod_disk_cache代替mod_mem_cache的话，<br />
		# 那么就取消上面的注释，并将下面的LoadModule行加上注释<br />
        &lt;IfModule mod_disk_cache.c&gt;<br />
        <span class="indent">
          CacheRoot c:/cacheroot<br />
          CacheEnable disk  /<br />
          CacheDirLevels 5<br />
          CacheDirLength 3<br />
        </span>
        &lt;/IfModule&gt; <br />
        <br />
        LoadModule mem_cache_module modules/mod_mem_cache.so<br />
        &lt;IfModule mod_mem_cache.c&gt;<br />
        <span class="indent">
          CacheEnable mem  /<br />
          MCacheSize 4096<br />
          MCacheMaxObjectCount 100<br />
          MCacheMinObjectSize 1<br />
          MCacheMaxObjectSize 2048<br />
        </span>
        &lt;/IfModule&gt;<br />
        <br />
        # 在充当代理的时候，不缓存update-list下的内容<br />
        CacheDisable http://security.update.server/update-list/<br />
      </span>
      &lt;/IfModule&gt;
    </code></p></div>
</div>
<div class="top"><a href="mod_cache.html#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="directive-section"><h2><a name="CacheDefaultExpire" id="CacheDefaultExpire">CacheDefaultExpire</a> <a name="cachedefaultexpire" id="cachedefaultexpire">指令</a></h2>
<table border="1" cellpadding="0" cellspacing="0" bordercolor="#AAAAAA" class="directive">
<tr><th><a href="directive-dict.html#Description">说明</a></th><td>默认缓存有效期(秒)</td></tr>
<tr><th><a href="directive-dict.html#Syntax">语法</a></th><td><code>CacheDefaultExpire <var>seconds</var></code></td></tr>
<tr><th><a href="directive-dict.html#Default">默认值</a></th><td><code>CacheDefaultExpire 3600 (一小时)</code></td></tr>
<tr><th><a href="directive-dict.html#Context">作用域</a></th><td>server config, virtual host</td></tr>
<tr><th><a href="directive-dict.html#Status">状态</a></th><td>扩展(E)</td></tr>
<tr><th><a href="directive-dict.html#Module">模块</a></th><td>mod_cache</td></tr>
</table>
    <p><code class="directive">CacheDefaultExpire</code>指令设置了那些既没有包含"Expires"或"Cache-Control"头，也没有包含"Last-Modified"头的缓存对象的默认有效期(按秒计)。<code class="directive">CacheMaxExpire</code>指令的值并<em>不会</em>覆盖这里的设置。</p>

    <div class="example"><p><code>
      CacheDefaultExpire 86400
    </code></p></div>

</div>
<div class="top"><a href="mod_cache.html#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="directive-section"><h2><a name="CacheDisable" id="CacheDisable">CacheDisable</a> <a name="cachedisable" id="cachedisable">指令</a></h2>
<table border="1" cellpadding="0" cellspacing="0" bordercolor="#AAAAAA" class="directive">
<tr><th><a href="directive-dict.html#Description">说明</a></th><td>禁止缓存某些特定的URL</td></tr>
<tr><th><a href="directive-dict.html#Syntax">语法</a></th><td><code>CacheDisable <var> url-string</var></code></td></tr>
<tr><th><a href="directive-dict.html#Context">作用域</a></th><td>server config, virtual host</td></tr>
<tr><th><a href="directive-dict.html#Status">状态</a></th><td>扩展(E)</td></tr>
<tr><th><a href="directive-dict.html#Module">模块</a></th><td>mod_cache</td></tr>
</table>
    <p><code class="directive">CacheDisable</code>指令表示<em>禁止</em>缓存<var>url-string</var>自身以及所有以<var>url-string</var>开头的URL。</p>

    <div class="example"><h3>示例</h3><p><code>
      CacheDisable /local_files
    </code></p></div>

</div>
<div class="top"><a href="mod_cache.html#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="directive-section"><h2><a name="CacheEnable" id="CacheEnable">CacheEnable</a> <a name="cacheenable" id="cacheenable">指令</a></h2>
<table border="1" cellpadding="0" cellspacing="0" bordercolor="#AAAAAA" class="directive">
<tr><th><a href="directive-dict.html#Description">说明</a></th><td>使用特定的存储类型缓存某些特定的URL</td></tr>
<tr><th><a href="directive-dict.html#Syntax">语法</a></th><td><code>CacheEnable <var>cache_type</var> <var>url-string</var></code></td></tr>
<tr><th><a href="directive-dict.html#Context">作用域</a></th><td>server config, virtual host</td></tr>
<tr><th><a href="directive-dict.html#Status">状态</a></th><td>扩展(E)</td></tr>
<tr><th><a href="directive-dict.html#Module">模块</a></th><td>mod_cache</td></tr>
</table>
    <p><code class="directive">CacheEnable</code> directive instructs
    <code class="module"><a href="mod_cache.html">mod_cache</a></code> to cache urls at or below
    <var>url-string</var>. The cache storage manager is specified with the
    <var>cache_type</var> argument. <var>cache_type</var> <code> mem</code>
    instructs <code class="module"><a href="mod_cache.html">mod_cache</a></code> to use the memory based storage
    manager implemented by <code class="module"><a href="mod_mem_cache.html">mod_mem_cache</a></code>.
    <var>cache_type</var> <code>disk</code> instructs
    <code class="module"><a href="mod_cache.html">mod_cache</a></code> to use the disk based storage manager
    implemented by <code class="module"><a href="mod_disk_cache.html">mod_disk_cache</a></code>.
    <var>cache_type</var> <code>fd</code> instructs
    <code class="module"><a href="mod_cache.html">mod_cache</a></code> to use the file descriptor cache implemented
    by <code class="module"><a href="mod_mem_cache.html">mod_mem_cache</a></code>.</p>
    <p>In the event that the URL space overlaps between different
    <code class="directive">CacheEnable</code> directives (as in the example below),
    each possible storage manager will be run until the first one that
    actually processes the request. The order in which the storage managers are
    run is determined by the order of the <code class="directive">CacheEnable</code>
    directives in the configuration file.</p>

    <div class="example"><p><code>
      CacheEnable  mem   /manual<br />
      CacheEnable  fd    /images<br />
      CacheEnable  disk  /<br />
    </code></p></div>

    <p>When acting as a forward proxy server, <var>url-string</var> can
    also be used to specify remote sites and proxy protocols which
    caching should be enabled for.</p>

    <div class="example"><p><code>
      # Cache proxied url's<br />
      CacheEnable  disk  /<br /><br />
      # Cache FTP-proxied url's<br />
      CacheEnable  disk  ftp://<br /><br />
      # Cache content from www.apache.org<br />
      CacheEnable  disk  https://www.apache.org/<br />
    </code></p></div>


</div>
<div class="top"><a href="mod_cache.html#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="directive-section"><h2><a name="CacheIgnoreCacheControl" id="CacheIgnoreCacheControl">CacheIgnoreCacheControl</a> <a name="cacheignorecachecontrol" id="cacheignorecachecontrol">指令</a></h2>
<table border="1" cellpadding="0" cellspacing="0" bordercolor="#AAAAAA" class="directive">
<tr><th><a href="directive-dict.html#Description">说明</a></th><td>Ignore request to not serve cached content to client</td></tr>
<tr><th><a href="directive-dict.html#Syntax">语法</a></th><td><code>CacheIgnoreCacheControl On|Off</code></td></tr>
<tr><th><a href="directive-dict.html#Default">默认值</a></th><td><code>CacheIgnoreCacheControl Off</code></td></tr>
<tr><th><a href="directive-dict.html#Context">作用域</a></th><td>server config, virtual host</td></tr>
<tr><th><a href="directive-dict.html#Status">状态</a></th><td>扩展(E)</td></tr>
<tr><th><a href="directive-dict.html#Module">模块</a></th><td>mod_cache</td></tr>
</table>
    <p>Ordinarily, requests containing a Cache-Control: no-cache or
    Pragma: no-cache header value will not be served from the cache.  The
    <code class="directive">CacheIgnoreCacheControl</code> directive allows this
    behavior to be overridden.  <code class="directive">CacheIgnoreCacheControl</code>
    On tells the server to attempt to serve the resource from the cache even
    if the request contains no-cache header values.  Resources requiring
    authorization will <em>never</em> be cached.</p>

    <div class="example"><p><code>
      CacheIgnoreCacheControl On
    </code></p></div>

    <div class="warning"><h3>Warning:</h3>
       This directive will allow serving from the cache even if the client has
       requested that the document not be served from the cache.  This might
       result in stale content being served.
    </div>

<h3>参见</h3>
<ul>
<li><code class="directive"><a href="mod_cache.html#cachestoreprivate">CacheStorePrivate</a></code></li>
<li><code class="directive"><a href="mod_cache.html#cachestorenostore">CacheStoreNoStore</a></code></li>
</ul>
</div>
<div class="top"><a href="mod_cache.html#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="directive-section"><h2><a name="CacheIgnoreHeaders" id="CacheIgnoreHeaders">CacheIgnoreHeaders</a> <a name="cacheignoreheaders" id="cacheignoreheaders">指令</a></h2>
<table border="1" cellpadding="0" cellspacing="0" bordercolor="#AAAAAA" class="directive">
<tr><th><a href="directive-dict.html#Description">说明</a></th><td>Do not store the given HTTP header(s) in the cache.
</td></tr>
<tr><th><a href="directive-dict.html#Syntax">语法</a></th><td><code>CacheIgnoreHeaders <var>header-string</var> [<var>header-string</var>] ...</code></td></tr>
<tr><th><a href="directive-dict.html#Default">默认值</a></th><td><code>CacheIgnoreHeaders None</code></td></tr>
<tr><th><a href="directive-dict.html#Context">作用域</a></th><td>server config, virtual host</td></tr>
<tr><th><a href="directive-dict.html#Status">状态</a></th><td>扩展(E)</td></tr>
<tr><th><a href="directive-dict.html#Module">模块</a></th><td>mod_cache</td></tr>
</table>
    <p>According to RFC 2616, hop-by-hop HTTP headers are not stored in
    the cache.  The following HTTP headers are hop-by-hop headers and thus
    do not get stored in the cache in <em>any</em> case regardless of the
    setting of <code class="directive">CacheIgnoreHeaders</code>:</p>

    <ul>
      <li><code>Connection</code></li>
      <li><code>Keep-Alive</code></li>
      <li><code>Proxy-Authenticate</code></li>
      <li><code>Proxy-Authorization</code></li>
      <li><code>TE</code></li>
      <li><code>Trailers</code></li>
      <li><code>Transfer-Encoding</code></li>
      <li><code>Upgrade</code></li>
    </ul>

    <p><code class="directive">CacheIgnoreHeaders</code> specifies additional HTTP
    headers that should not to be stored in the cache.  For example, it makes
    sense in some cases to prevent cookies from being stored in the cache.</p>

    <p><code class="directive">CacheIgnoreHeaders</code> takes a space separated list
    of HTTP headers that should not be stored in the cache. If only hop-by-hop
    headers not should be stored in the cache (the RFC 2616 compliant
    behaviour), <code class="directive">CacheIgnoreHeaders</code> can be set to
    <code>None</code>.</p>

    <div class="example"><h3>Example 1</h3><p><code>
      CacheIgnoreHeaders Set-Cookie
    </code></p></div>

    <div class="example"><h3>Example 2</h3><p><code>
      CacheIgnoreHeaders None
    </code></p></div>

    <div class="warning"><h3>Warning:</h3>
      If headers like <code>Expires</code> which are needed for proper cache
      management are not stored due to a
      <code class="directive">CacheIgnoreHeaders</code> setting, the behaviour of
      mod_cache is undefined.
    </div>

</div>
<div class="top"><a href="mod_cache.html#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="directive-section"><h2><a name="CacheIgnoreNoLastMod" id="CacheIgnoreNoLastMod">CacheIgnoreNoLastMod</a> <a name="cacheignorenolastmod" id="cacheignorenolastmod">指令</a></h2>
<table border="1" cellpadding="0" cellspacing="0" bordercolor="#AAAAAA" class="directive">
<tr><th><a href="directive-dict.html#Description">说明</a></th><td>Ignore the fact that a response has no Last Modified
header.</td></tr>
<tr><th><a href="directive-dict.html#Syntax">语法</a></th><td><code>CacheIgnoreNoLastMod On|Off</code></td></tr>
<tr><th><a href="directive-dict.html#Default">默认值</a></th><td><code>CacheIgnoreNoLastMod Off</code></td></tr>
<tr><th><a href="directive-dict.html#Context">作用域</a></th><td>server config, virtual host</td></tr>
<tr><th><a href="directive-dict.html#Status">状态</a></th><td>扩展(E)</td></tr>
<tr><th><a href="directive-dict.html#Module">模块</a></th><td>mod_cache</td></tr>
</table>
    <p>Ordinarily, documents without a last-modified date are not cached.
    Under some circumstances the last-modified date is removed (during
    <code class="module"><a href="mod_include.html">mod_include</a></code> processing for example) or not provided
    at all. The <code class="directive">CacheIgnoreNoLastMod</code> directive
    provides a way to specify that documents without last-modified dates
    should be considered for caching, even without a last-modified date.
    If neither a last-modified date nor an expiry date are provided with
    the document then the value specified by the
    <code class="directive">CacheDefaultExpire</code> directive will be used to
    generate an expiration date.</p>

    <div class="example"><p><code>
      CacheIgnoreNoLastMod On
    </code></p></div>

</div>
<div class="top"><a href="mod_cache.html#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="directive-section"><h2><a name="CacheIgnoreQueryString" id="CacheIgnoreQueryString">CacheIgnoreQueryString</a> <a name="cacheignorequerystring" id="cacheignorequerystring">指令</a></h2>
<table class="directive">
<tr><th><a href="directive-dict.html#Description">说明</a></th><td>Ignore query string when caching</td></tr>
<tr><th><a href="directive-dict.html#Syntax">语法</a></th><td><code>CacheIgnoreQueryString On|Off</code></td></tr>
<tr><th><a href="directive-dict.html#Default">默认值</a></th><td><code>CacheIgnoreQueryString Off</code></td></tr>

<tr><th><a href="directive-dict.html#Context">作用域</a></th><td>server config, virtual host</td></tr>
<tr><th><a href="directive-dict.html#Status">状态</a></th><td>Extension</td></tr>
<tr><th><a href="directive-dict.html#Module">模块</a></th><td>mod_cache</td></tr>
<tr><th><a href="directive-dict.html#Compatibility">兼容性</a></th><td>Available in Apache 2.2.6 and later</td></tr>
</table>
    <p>Ordinarily, requests with query string parameters are cached separately
    for each unique query string. This is according to RFC 2616/13.9 done only
    if an expiration time is specified. The
    <code class="directive">CacheIgnoreQueryString</code> directive tells the cache to
    cache requests even if no expiration time is specified, and to reply with
    a cached reply even if the query string differs. From a caching point of
    view the request is treated as if having no query string when this
    directive is enabled.</p>

    <div class="example"><p><code>
      CacheIgnoreQueryString On
    </code></p></div>


</div>
<div class="top"><a href="mod_cache.html#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="directive-section"><h2><a name="CacheLastModifiedFactor" id="CacheLastModifiedFactor">CacheLastModifiedFactor</a> <a name="cachelastmodifiedfactor" id="cachelastmodifiedfactor">指令</a></h2>
<table border="1" cellpadding="0" cellspacing="0" bordercolor="#AAAAAA" class="directive">
<tr><th><a href="directive-dict.html#Description">说明</a></th><td>The factor used to compute an expiry date based on the
LastModified date.</td></tr>
<tr><th><a href="directive-dict.html#Syntax">语法</a></th><td><code>CacheLastModifiedFactor <var>float</var></code></td></tr>
<tr><th><a href="directive-dict.html#Default">默认值</a></th><td><code>CacheLastModifiedFactor 0.1</code></td></tr>
<tr><th><a href="directive-dict.html#Context">作用域</a></th><td>server config, virtual host</td></tr>
<tr><th><a href="directive-dict.html#Status">状态</a></th><td>扩展(E)</td></tr>
<tr><th><a href="directive-dict.html#Module">模块</a></th><td>mod_cache</td></tr>
</table>
    <p>In the event that a document does not provide an expiry date but does
    provide a last-modified date, an expiry date can be calculated based on
    the time since the document was last modified. The
    <code class="directive">CacheLastModifiedFactor</code> directive specifies a
    <var>factor</var> to be used in the generation of this expiry date
    according to the following formula:

    <code>expiry-period = time-since-last-modified-date * <var>factor</var>
    expiry-date = current-date + expiry-period</code>

    For example, if the document was last modified 10 hours ago, and
    <var>factor</var> is 0.1 then the expiry-period will be set to
    10*0.1 = 1 hour. If the current time was 3:00pm then the computed
    expiry-date would be 3:00pm + 1hour = 4:00pm.

    If the expiry-period would be longer than that set by
    <code class="directive">CacheMaxExpire</code>, then the latter takes
    precedence.</p>

    <div class="example"><p><code>
      CacheLastModifiedFactor 0.5
    </code></p></div>

</div>
<div class="top"><a href="mod_cache.html#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="directive-section"><h2><a name="CacheMaxExpire" id="CacheMaxExpire">CacheMaxExpire</a> <a name="cachemaxexpire" id="cachemaxexpire">指令</a></h2>
<table border="1" cellpadding="0" cellspacing="0" bordercolor="#AAAAAA" class="directive">
<tr><th><a href="directive-dict.html#Description">说明</a></th><td>The maximum time in seconds to cache a document</td></tr>
<tr><th><a href="directive-dict.html#Syntax">语法</a></th><td><code>CacheMaxExpire <var>seconds</var></code></td></tr>
<tr><th><a href="directive-dict.html#Default">默认值</a></th><td><code>CacheMaxExpire 86400 (one day)</code></td></tr>
<tr><th><a href="directive-dict.html#Context">作用域</a></th><td>server config, virtual host</td></tr>
<tr><th><a href="directive-dict.html#Status">状态</a></th><td>扩展(E)</td></tr>
<tr><th><a href="directive-dict.html#Module">模块</a></th><td>mod_cache</td></tr>
</table>
    <p><code class="directive">CacheMaxExpire</code> directive specifies the maximum number of
    seconds for which cachable HTTP documents will be retained without checking the origin
    server. Thus, documents will be out of date at most this number of seconds. This maximum
    value is enforced even if an expiry date was supplied with the document.</p>

    <div class="example"><p><code>
      CacheMaxExpire 604800
    </code></p></div>

</div>
<div class="top"><a href="mod_cache.html#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="directive-section"><h2><a name="CacheStoreNoStore" id="CacheStoreNoStore">CacheStoreNoStore</a> <a name="cachestorenostore" id="cachestorenostore">指令</a></h2>
<table border="1" cellpadding="0" cellspacing="0" bordercolor="#AAAAAA" class="directive">
<tr><th><a href="directive-dict.html#Description">说明</a></th><td>Attempt to cache requests or responses that have been marked as no-store.</td></tr>
<tr><th><a href="directive-dict.html#Syntax">语法</a></th><td><code>CacheStoreNoStore On|Off</code></td></tr>
<tr><th><a href="directive-dict.html#Default">默认值</a></th><td><code>CacheStoreNoStore Off</code></td></tr>
<tr><th><a href="directive-dict.html#Context">作用域</a></th><td>server config, virtual host</td></tr>
<tr><th><a href="directive-dict.html#Status">状态</a></th><td>扩展(E)</td></tr>
<tr><th><a href="directive-dict.html#Module">模块</a></th><td>mod_cache</td></tr>
</table>
    <p>Ordinarily, requests or responses with Cache-Control: no-store header
       values will not be stored in the cache.  The
       <code class="directive">CacheStoreNoCache</code> directive allows this
       behavior to be overridden.  <code class="directive">CacheStoreNoCache</code> On
       tells the server to attempt to cache the resource even if it contains
       no-store header values.  Resources requiring authorization will
       <em>never</em> be cached.</p>

    <div class="example"><p><code>
      CacheStoreNoStore On
    </code></p></div>

    <div class="warning"><h3>Warning:</h3>
       As described in RFC 2616, the no-store directive is intended to
       "prevent the inadvertent release or retention of sensitive information
       (for example, on backup tapes)."  Enabling this option could store
       sensitive information in the cache.  You are hereby warned.
    </div>

<h3>参见</h3>
<ul>
<li><code class="directive"><a href="mod_cache.html#cacheignorecachecontrol">CacheIgnoreCacheControl</a></code></li>
<li><code class="directive"><a href="mod_cache.html#cachestoreprivate">CacheStorePrivate</a></code></li>
</ul>
</div>
<div class="top"><a href="mod_cache.html#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="directive-section"><h2><a name="CacheStorePrivate" id="CacheStorePrivate">CacheStorePrivate</a> <a name="cachestoreprivate" id="cachestoreprivate">指令</a></h2>
<table border="1" cellpadding="0" cellspacing="0" bordercolor="#AAAAAA" class="directive">
<tr><th><a href="directive-dict.html#Description">说明</a></th><td>Attempt to cache responses that the server has marked as private</td></tr>
<tr><th><a href="directive-dict.html#Syntax">语法</a></th><td><code>CacheStorePrivate On|Off</code></td></tr>
<tr><th><a href="directive-dict.html#Default">默认值</a></th><td><code>CacheStorePrivate Off</code></td></tr>
<tr><th><a href="directive-dict.html#Context">作用域</a></th><td>server config, virtual host</td></tr>
<tr><th><a href="directive-dict.html#Status">状态</a></th><td>扩展(E)</td></tr>
<tr><th><a href="directive-dict.html#Module">模块</a></th><td>mod_cache</td></tr>
</table>
    <p>Ordinarily, responses with Cache-Control: private header values will not
       be stored in the cache.  The <code class="directive">CacheStorePrivate</code>
       directive allows this behavior to be overridden.
       <code class="directive">CacheStorePrivate</code> On
       tells the server to attempt to cache the resource even if it contains
       private header values.  Resources requiring authorization will
       <em>never</em> be cached.</p>

    <div class="example"><p><code>
      CacheStorePrivate On
    </code></p></div>

    <div class="warning"><h3>Warning:</h3>
       This directive will allow caching even if the upstream server has
       requested that the resource not be cached.  This directive is only
       ideal for a 'private' cache.
    </div>

<h3>参见</h3>
<ul>
<li><code class="directive"><a href="mod_cache.html#cacheignorecachecontrol">CacheIgnoreCacheControl</a></code></li>
<li><code class="directive"><a href="mod_cache.html#cachestorenostore">CacheStoreNoStore</a></code></li>
</ul>
</div>
</div>
<div id="footer">
<p class="apache">本文允许自由的转载、引用、再分发，但必须保留译者署名并注明出处；详见：<a href="../translator_announcement.html#announcement">版权声明</a>。</p>
<p class="menu"><a href="index.html">模块索引</a> | <a href="directives.html">指令索引</a> | <a href="../faq/index.html">常见问题</a> | <a href="../glossary.html">词汇表</a> | <a href="../sitemap.html">站点导航</a></p></div>
</body></html>
